home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 1 / PC Actual CD 01.iso / share / dos / graficos / plydat14.arj / ZONAL.PI < prev    next >
Encoding:
Text File  |  1992-04-05  |  1.3 KB  |  53 lines

  1. // Sample transcendental surface.  This is a zonal harmonic.  This file shows
  2. // a way that a surface that is defined in spherical variables can be
  3. // represented in cartesian coordinates and ray-traced.  The surface itself
  4. // is a sphere modified by an associated Legendre polynomial.
  5. // Polyray input file - Alexander Enzmann
  6.  
  7. // Set up the camera
  8. viewpoint {
  9.    from <0,2,-5>
  10.    at <0,0,0>
  11.    up <0,1,0>
  12.    angle 30
  13.    resolution 160, 160
  14.    }
  15.  
  16. // Set up background color & lights
  17. background SkyBlue
  18. light <10, 20, -30>
  19.  
  20. // Define the color of the surface
  21. define shiny_red
  22. texture {
  23.    surface {
  24.       ambient red, 0.2
  25.       diffuse red, 0.6
  26.       specular white, 0.8
  27.       microfacet Reitz 10
  28.       }
  29.    }
  30.  
  31. define two_sphere object { sphere <0,0,0>, 2 }
  32.  
  33. // Conversion from polar to rectangular (for a left-handed
  34. // coordinate system):
  35. //
  36. //  r     = sqrt(x^2 + y^2 + z^2),
  37. //  theta = atan(y/x),
  38. //  phi   = atan(sqrt(x^2 + y^2)/z)
  39. //
  40. // Surface is:
  41. //   r = 1 + c * LegendreP(3,0,cos(phi))
  42. //   r = 1 + c * 2.5 * cos(phi)^3 - 1.5 * cos(phi)
  43. // For this surface, use c = 0.2
  44.  
  45. // Define a zonal harmonic surface
  46. define phi atan(sqrt(x^2 + z^2)/y)
  47. define r sqrt(x^2 + y^2 + z^2)
  48. object {
  49.    function r - (1 + 0.5 * cos(phi)^3 - 0.3 * cos(phi))
  50.    shiny_red
  51.    bounds two_sphere
  52.    }
  53.